package com.wanho.java157.SystemSetting.controller;

import com.wanho.java157.SystemSetting.po.Employee;
import com.wanho.java157.SystemSetting.po.Login;
import com.wanho.java157.SystemSetting.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;


@Controller
@RequestMapping("/login")
public class LoginController {
    @Autowired
    private LoginService loginService;

    @RequestMapping("/loginCheck")
    @ResponseBody
    public Map<String,String> loginCheck(Login login){
//        System.out.println("============>"+login);
        int count = loginService.selectCount(String.valueOf(login.getEmployeeId()),login.getPassword());
        Map<String,String> map = new HashMap<>() ;

        if (count==0){
            map.put("status","0") ;
            return map;
        }
        map.put("status","1") ;

        return map;


    }

    @RequestMapping("/loginToCms")
    public String loginToCms(Model model){



        return "index";

    }
}
